<?php $this->load->view('header/standard'); ?>
    <div id="main">
        <div class="container">
            <div class="span-17 colborder" id="content">
                <?php if (isset($messages)) echo $messages; ?>
                <?php if ($stats): ?>
                <fieldset class="span-16 last box">
                    <legend class="caps">Statistics</legend>
                
                <table width="100%" border="0" class="main_text">
                <tbody>
                    <tr class="stats-header">
                        <td valign="top" colspan="5">Totales</td>
                    </tr>
                    <tr>
                        <td>Primer vuelo ingresado</td>
                        <td><?php echo $stats['first_flight_date']; ?></td>
                        <td width="5">&nbsp;</td>
                        <td>Distancia Total(km) </td>
                        <td><?php echo Converter::m2Km($stats['total_distance']); ?></td>
                    </tr>
                      <tr>
                        <td class="odd">Ultimo vuelo ingresado</td>
                        <td class="odd"><?php echo $stats['last_flight_date']; ?></td>
                        <td>&nbsp;</td>
                        <td class="odd">Puntaje Total OLC</td>
                        <td class="odd"><?php echo sprintf("%.2f", $stats['total_olc_score']); ?></td>
                      </tr>
                      <tr>
                        <td>Período de vuelo cubierto</td>
                        <td><?php echo Converter::time2Period($stats['flying_period']); ?></td>
                        <td>&nbsp;</td>
                        <td>Total de Horas de Vuelo (hh:mm)</td>
                        <td><?php echo Converter::secs2Time($stats['total_duration']); ?></td>
                      </tr>
                      <tr>
                        <td class="odd">&nbsp;</td>
                        <td class="odd">&nbsp;</td>
                        <td>&nbsp;</td>
                        <td class="odd">Cantidad de Vuelos </td>
                        <td class="odd"><?php echo $stats['total_flights']; ?></td>
                      </tr>
                     <tr class="stats-header">
                        <td colspan="5">
                          Mejores Resultados Personales</td>
                      </tr>
                     
                      <tr>
                        <td>Mejor Distancia Libre (km) </td>
                        <td><?php echo Converter::m2Km($stats['best_distance']); ?></td>
                        <td>&nbsp;</td>
                        <td>Mejor Puntaje OLC</td>
                        <td><?php echo sprintf("%.2f", $stats['best_olc_score']); ?></td>
                      </tr>
                      <tr>
                        <td class="odd">Mejor Triángulo FAI (km)</td>
                        <td class="odd"><? echo $stats['best_fai_triangle'] ?></td>
                        <td>&nbsp;</td>
                        <td class="odd">Record de Altura Absoluta (m)</td>
                        <td class="odd"><?php echo $stats['max_altitude']; ?></td>
                      </tr>
                      <tr>
                        <td>Mejor Triángulo Libre (km) </td>
                        <td><? echo $stats['best_free_triangle'] ?></td>
                        <td>&nbsp;</td>
                        <td>Record en ganacia de Altura (m)</td>
                        <td> <span class="altitude_style"><?php echo $stats['max_altitude_gain']?> m</span> </td>
                      </tr>
                      <tr>
                        <td class="odd">Vuelo Más Largo (hh:mm)</td>
                        <td class="odd"><?php echo Converter::secs2Time($stats['max_duration']); ?></td>
                        <td>&nbsp;</td>
                        <td class="odd"></td>
                        <td class="odd">&nbsp;</td>
                      </tr>
                      <tr><td>&nbsp;</td></tr>
                      <tr class="stats-header">
                        <td colspan="5">Valores Promedio</td>
                      </tr>
                      <tr>
                        <td>Distancia Promedio por Vuelo (km) </td>
                        <td><? echo Converter::m2Km($stats['mean_distance']) ?></td>
                        <td>&nbsp;</td>
                        <td>Duración Promedio por Vuelo (hh:mm)</td>
                        <td><? echo Converter::secs2Time($stats["mean_duration"]) ?></td>
                      </tr>
                      <tr>
                        <td class="odd">Vuelos Promedio por Mes</td>
                        <td class="odd"><? echo $stats['mean_flights_per_month']; ?></td>
                        <td>&nbsp;</td>
                        <td class="odd">Vuelos Promedio por Año</td>
                        <td class="odd"> <? echo $stats['mean_flights_per_year']; ?></td>
                      </tr>
                      <tr>
                        <td>Distancia Promedio por Mes (km) </td>
                        <td><? echo $stats['mean_duration_per_month'] ?></td>
                        <td>&nbsp;</td>
                        <td>Distancia Promedio por Año (km) </td>
                        <td><? echo $stats['mean_duration_per_year'] ?></td>
                      </tr>
                      <tr>
                        <td class="odd">Duración Promedio por Mes (hh:mm) </td>
                        <td class="odd"><? echo $stats['mean_distance_per_month'] ?></td>
                        <td>&nbsp;</td>
                        <td class="odd">Duración Promedio por Año (hh:mm)</td>
                        <td class="odd"><? echo $stats['mean_distance_per_year'] ?></td>
                      </tr>
                    </tbody>
                    </table>
                </fieldset>
                <?php endif; ?>
            </div> <!-- end content -->
            <div class="span-6 last" id="sidebar">
              <?php $this->load->view('menu/sidebar', array('person' => $person, 'context' => 'home'))?>        
            </div> <!-- end sidebar -->
        </div>
    </div> <!-- end main -->
<?php $this->load->view('footer/standard');?>
